    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>特定日期倒计时</title>
        <style>
            *{
                margin:0;
                padding: 0;
            }
            div{
                height: 46px;
                width: 800px;
                /*background-color: #1A66B3;*/
                margin: 100px auto;
                font-size: 36px;
                font-weight: 600;
                color: #ff5459;
                font-family: FangSong;
            }

        </style>
    </head>
    <body>
    <div></div>
    <script>
        setInterval(fn,1);
        function fn() {
        var div=document.getElementsByTagName("div")[0];
        var date1=new Date();
        var date2=new Date("2019/05/01 00:00:00");
        var sumtime=date2.getTime()-date1.getTime();
        var day=parseInt(sumtime/1000/60/60/24);

       var hour =parseInt(sumtime/1000/60/60%24);

        var minute=parseInt(sumtime/1000/60%60);

        var second=parseInt(sumtime/1000%60);

        var msecond=parseInt(sumtime%1000);
     if(day<10){
         day="0"+day;
     }
     if(hour<10){
         hour="0"+hour;
     }
     if(minute<10){
         minute="0"+minute;
     }
     if(second<10){
         second="0"+second;
     }
     if(msecond<100&&msecond>10){
         msecond="0"+msecond;
     } else if(msecond<10){
         msecond="00"+msecond;
     }

            div.innerHTML="距离劳动节还有"+day+"天"+hour+"小时"+minute+"分钟"+second+"秒"+msecond+"毫秒";
        }
    </script>
    </body>
    </html>